/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.dinotrack.domain;

import org.hibernate.SQLQuery;
import org.hibernate.Session;

/**
 *
 * @author Mathews
 */
public class ComentarioSQL {

    Session session = null;

    public ComentarioSQL() 
    {
        session = HibernateUtil.getSessionFactory().getCurrentSession();
    }

    public boolean registrarUsuario(Comentario comentario) 
    {
        try 
        {
            session.beginTransaction();
            SQLQuery q=session.createSQLQuery("call usuario_registrar(?, ?, ?)");
            q.setParameter(0, comentario.getIdComentario());
            q.setParameter(1, comentario.getComentario());
            q.setParameter(2, comentario.getCancion());
            q.executeUpdate();
            session.getTransaction().commit();
            
            return true;

        } catch (Exception e) {
            e.printStackTrace();
        }
        
        return false;

    }    
    
}
